#ifndef _MESH_VIEWER_MESH_COLOR_MAPPER_H_
#define _MESH_VIEWER_MESH_COLOR_MAPPER_H_

#include <mesh/mesh.h>


namespace mesh
{

class mesh_color_mapper
{
public:

  explicit mesh_color_mapper(mesh const& m);

  typedef mesh::triangle triangle;
  typedef mesh::vertex vertex;
  typedef mesh::edge edge;
  typedef std::array<float,3> color;

  void set_face_color(unsigned face_id, color const& c)
  { _faces_colors[face_id] = c; }

  void set_edge_color(unsigned edge_id, color const& c)
  { _edges_colors[edge_id] = c; }

  void set_vertex_color(unsigned vertex_id, color const& c)
  { _vertices_colors[vertex_id] = c; }

  std::vector<triangle> const& faces(void) const
  { return _mesh.faces(); }

  std::vector<vertex> const& vertices(void) const
  { return _mesh.vertices(); }

  std::vector<edge> const& edges(void) const
  { return _mesh.edges(); }

  std::vector<color> const& faces_colors(void) const
  { return _faces_colors; }

  std::vector<color>& faces_colors(void)
  { return _faces_colors; }

  std::vector<color> const& edges_colors(void) const
  { return _edges_colors; }

  std::vector<color>& edges_colors(void)
  { return _edges_colors; }

  std::vector<color> const& vertices_colors(void) const
  { return _vertices_colors; }

  std::vector<color>& vertices_colors(void)
  { return _vertices_colors; }

private:

  mesh const& _mesh;
  std::vector<color> _edges_colors;
  std::vector<color> _vertices_colors;
  std::vector<color> _faces_colors;
};



} // mesh

#endif //
